---
const serverPanels = [
  {
    id: 1,
    name: "宝塔开心版-BTweb",
    desc: "btweb.co,LAMP/LN...",
    logo: "https://via.placeholder.com/80x80?text=宝",
    tags: ["服务器面板"],
    url: "https://btweb.co"
  },
  {
    id: 2,
    name: "耗子面板",
    desc: "简单轻量·高效运维",
    logo: "https://via.placeholder.com/80x80?text=耗",
    tags: ["服务器面板"],
    url: "https://haoshi.com"
  },
  {
    id: 3,
    name: "Websoft9",
    desc: "Websoft9（微聚云...）",
    logo: "https://via.placeholder.com/80x80?text=W",
    tags: ["服务器面板", "#低代码", "#元"],
    url: "https://www.websoft9.com"
  },
  {
    id: 4,
    name: "AppNode",
    desc: "AppNode官网,LNMP...",
    logo: "https://via.placeholder.com/80x80?text=AN",
    tags: ["服务器面板", "#AppNode官网"],
    url: "https://appnode.com"
  },
  {
    id: 5,
    name: "AMH",
    desc: "AMH - 国内领先的云...",
    logo: "https://via.placeholder.com/80x80?text=★",
    tags: ["服务器面板", "#AMH", "#Apac"],
    url: "https://amh.sh"
  },
  {
    id: 6,
    name: "小皮面板(phpstudy)",
    desc: "小皮面板，好用安全...",
    logo: "https://via.placeholder.com/80x80?text=小",
    tags: ["服务器面板", "#linux面板", "#php"],
    url: "https://www.xp.cn"
  },
  {
    id: 7,
    name: "1Panel",
    desc: "1Panel 是一个现代...",
    logo: "https://via.placeholder.com/80x80?text=1",
    tags: ["服务器面板", "#1Panel", "#coi"],
    url: "https://1panel.dev"
  },
  {
    id: 8,
    name: "宝塔面板",
    desc: "宝塔，让运维简单高...",
    logo: "https://via.placeholder.com/80x80?text=🛡️",
    tags: ["常用推荐", "服务器面板"],
    url: "https://www.bt.cn"
  }
];
---

<div class="container mx-auto px-4 py-8 min-h-screen">
  <!-- 顶部导航栏 -->
  <div class="flex items-center justify-between mb-6">
    <div class="flex space-x-2">
      <button class="px-4 py-2 text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors">云计算</button>
      <button class="px-4 py-2 text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors">云服务器</button>
      <button class="px-4 py-2 text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors">CDN</button>
      <button class="px-4 py-2 text-white bg-red-600 rounded-lg hover:bg-red-700 transition-colors">服务器面板</button>
    </div>
    <button class="text-sm text-gray-500 hover:text-gray-700">more+</button>
  </div>

  <div class="flex flex-wrap gap-6 justify-center items-stretch">
    {serverPanels.map(panel => (
      <div 
        class="w-full sm:w-1/2 md:w-1/3 lg:w-1/4 p-1 bg-white rounded-xl shadow-sm border border-gray-100 hover:shadow-md transition-shadow duration-300 cursor-pointer group flex flex-col h-full flex-grow"
        title={panel.name}
      >
        <div class="flex items-center space-x-2 mb-3">
          <img src="/nice/static/images/thumbs/1.jpg" alt={panel.name} class="w-10 h-10 rounded-full" />
          <div class="flex-1 min-w-0">
            <h3 class="font-semibold text-gray-900 truncate">{panel.name}</h3>
            <p class="text-sm text-gray-500 truncate">{panel.desc}</p>
          </div>
        </div>
        
        <div class="flex-nowrap gap-1 mb-2 inline-flex justify-between">
          <!-- 将“服务器面板”标签前置 -->
          {panel.tags.includes("服务器面板") && (
            <span class="inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-red-100 text-red-800">
              服务器面板
            </span>
          )}
          {panel.tags.filter(tag => tag !== "服务器面板").map(tag => (
            <span class="inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800">
              {tag.startsWith('#') ? tag : <span class="mr-1">📁</span> + tag}
            </span>
          ))}
          <a 
            href={panel.url} 
            target="_blank" 
            rel="noopener noreferrer"
            class="text-sm text-red-600 hover:text-red-800 font-medium flex items-center"
            aria-label={`访问 ${panel.name}`}
          >
          <button class="text-gray-400 hover:text-gray-600 transition-colors">
            <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
            </svg>
          </button>
          </a>
        
        </div>
        
        <!-- Hover tooltip -->
        <div class="absolute bottom-0 left-0 right-0 hidden group-hover:block bg-black text-white text-xs p-2 rounded-t-lg z-10">
          {panel.url}
        </div>
      </div>
    ))}
  </div>
</div>